<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>Garrysmod Loading Page</title>
<style>
.roundtable{
background: rgba(10,10,10,.95);
border:10px solid #666;
border-radius:100px;
}
.rt{
background: rgba(102,102,102,1); 
border:10px solid #666; 
border-radius:10px;
}
.tr{
background: rgba(255,255,255,.75); 
border:1px solid #ffffff; 
border-radius:10px;
}
</style>
</head>
<body background="3.jpg">
<?php 
include("steam/SteamUserAPI.php");

	//Handler for building this API from Terminal CLI:
	if(substr(php_sapi_name(), 0, 3) == "cli")
		$userID = $argv[1]; //Pull ID from CLI args
	else
		$userID = $_GET["id"]; // Pull it from the apache / CGI / whatever

	//Call the SteamUser constructor with either the 17-digit Steam Community ID
    //or their custom URL (i.e. robinwalker)
	$user = new SteamUser($userID);
	$mapID = $_GET["mapname"];
 ?>
<center>
<script src=”http://snow-effect.googlecode.com/files/snow.js” type=”text/javascript”>
</script>
<div style='position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 75%; height: 75%; margin: auto; overflow: show;'>
<table class="roundtable" width="1000px" height="600px">
		</table>
		</div>
	<div style='position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 50%; height: 60%; margin: auto; overflow: show;'>
		<img src='b.png'>
		<div id='loadingtext' style='margin-top: 10px; color: #666; font-family: Arial; font-size: 20px; font-weight: bold;'>Loading Text..</div>
<?php
echo "<div class=\"left game-box\">";
echo "<div id='loadingtext' style='margin-top: 10px; color: #666; font-family: Arial; font-size: 15px; font-weight: bold;'>";
echo $user->game;
echo "<br/><table class='rt' width='200px' height='180px' cellspacing='0' cellpadding='0'><td><img src='{$user->avatarfull}'/><table class='tr' width='180px' height='50px' cellspacing='0' cellpadding='10'><td>User: {$user->steamID}<br/>Current map: $mapID</td></table></td></table>";
echo "</div>";
echo "</div>";
echo "<div class=\"clear\"></div>";
?>	
</div>
</center>
	<div style='-webkit-box-reflect: below -120px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.1, transparent), to(rgba(255, 255, 255, 1.0))); position: absolute; top: 90%; right: 0; bottom: 0; left: 5%; height: 100px; overflow: show; font-family: Arial; font-size: 24px; font-weight: bold; color: #666' id='files'>
	</div>

<script type="text/javascript">

	keywords = 
	[
	 "Tip: Don't RDM or kill people for no reason.", 
	 "Tip: Prop-killing can get you killed.",
	 "Tip: Welcome to the server!",
	 "Tip: Having a problem? Tell an admin right away!",
	 "Tip: Have a suggestion? Feel free to tell an admin!",
	 "Tip: Lacking trust? Try to find some trustworthy people!",
	 "Tip: Donate to help keep the server running!",
	 "Tip: Explore around to become familiar with most maps.",
	 "Tip: Pommy was here!", 
	 "Tip: Respect all members.",
	 "Tip: You are joining FeatherDev!",
	 "Tip: You're headed in the right direction!",
	 "Tip: Just a few more seconds....",
	 "Tip: Some players making you angry? Contact an admin ASAP.",
	 "Tip: Don't you love reading all these tips?",
	 "Tip: Respect Pommy or instant kick!",
	 "GLaD0S made a fake cake to make to late for your wedding day",
	 "Don't make any player enraged enless you want a kick"
	]


	var bCanChangeStatus = true;
	function ChangeText ( )	{
		if ( bCanChangeStatus )
		{
			var keyword = keywords[ Math.floor( Math.random() * keywords.length ) ]
			document.getElementById( "loadingtext" ).innerHTML = keyword;
		}
		
		setTimeout( "ChangeText()", 2500 );
	}
	
	ChangeText();
	
	var iFilesNeeded = 0;
	var iFilesTotal = 0;
	var bDownloadingFile = false;
	
	function SetFilesNeeded( iNeeded )
	{
		iFilesNeeded = iNeeded;
		RefreshFileBox();
	}
	
	function SetFilesTotal( iTotal )
	{
		iFilesTotal = iTotal;
		RefreshFileBox();
	}
	
	function DownloadingFile( filename )
	{
		if ( bDownloadingFile )
		{
			iFilesNeeded = iFilesNeeded - 1;
			RefreshFileBox();
		}
		
		document.getElementById( "loadingtext" ).innerHTML = "Downloading " + filename;
		bCanChangeStatus = false;
		setTimeout( "bCanChangeStatus = true;", 1000 );
		
		bDownloadingFile = true;
		
	}
	
	function SetStatusChanged( strstatus )
	{
		if ( bDownloadingFile )
		{
			iFilesNeeded = iFilesNeeded - 1;
			bDownloadingFile = false;
			RefreshFileBox();
		}
		
		document.getElementById( "loadingtext" ).innerHTML = status;
		bCanChangeStatus = false;
		setTimeout( "bCanChangeStatus = true;", 1000 );
	}
	
	function RefreshFileBox()
	{
		document.getElementById( "files" ).innerHTML = "<img src='download.png' style='position: relative; top: 7px;'> " + iFilesNeeded + " downloads remaining";
		
		if ( iFilesTotal > 0 )
			document.getElementById( "files" ).style.visibility = 'visible';
		else
			document.getElementById( "files" ).style.visibility = 'hidden';
	}
	
	RefreshFileBox();
	
</script>
</body></html>
